package com.lazycat.backend.controller.user;

import com.lazycat.backend.service.impl.user.CommentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class CommentController {
    @Autowired
    private CommentServiceImpl commentService;

    @PostMapping("user/comment/")
    public void comment(@RequestBody Map<String,String> map) {
        Integer commentatorId = Integer.parseInt(map.get("commentator_id"));
        Integer goodId = Integer.parseInt(map.get("good_id"));
        String text = map.get("text");
        commentService.comment(goodId, commentatorId, text);
    }
}
